<?php

/**
 * Pediatra filter form base class.
 *
 * @package    asindo
 * @subpackage filter
 * @author     Ignacio Calvo
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 24171 2009-11-19 16:37:50Z Kris.Wallsmith $
 */
abstract class BasePediatraFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'nombre'           => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'apellido1'        => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'apellido2'        => new sfWidgetFormFilterInput(),
      'fecha_alta'       => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'tipo_via'         => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'via'              => new sfWidgetFormFilterInput(),
      'cp'               => new sfWidgetFormFilterInput(),
      'numero'           => new sfWidgetFormFilterInput(),
      'piso'             => new sfWidgetFormFilterInput(),
      'letra'            => new sfWidgetFormFilterInput(),
      'poblacion'        => new sfWidgetFormFilterInput(),
      'provincia'        => new sfWidgetFormFilterInput(),
      'email'            => new sfWidgetFormFilterInput(),
      'telefono1'        => new sfWidgetFormFilterInput(),
      'telefono2'        => new sfWidgetFormFilterInput(),
      'telefono3'        => new sfWidgetFormFilterInput(),
      'numero_colegiado' => new sfWidgetFormFilterInput(),
      'de_asindo'        => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'observaciones'    => new sfWidgetFormFilterInput(),
    ));

    $this->setValidators(array(
      'nombre'           => new sfValidatorPass(array('required' => false)),
      'apellido1'        => new sfValidatorPass(array('required' => false)),
      'apellido2'        => new sfValidatorPass(array('required' => false)),
      'fecha_alta'       => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDateTime(array('required' => false)))),
      'tipo_via'         => new sfValidatorPass(array('required' => false)),
      'via'              => new sfValidatorPass(array('required' => false)),
      'cp'               => new sfValidatorPass(array('required' => false)),
      'numero'           => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'piso'             => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'letra'            => new sfValidatorPass(array('required' => false)),
      'poblacion'        => new sfValidatorPass(array('required' => false)),
      'provincia'        => new sfValidatorPass(array('required' => false)),
      'email'            => new sfValidatorPass(array('required' => false)),
      'telefono1'        => new sfValidatorPass(array('required' => false)),
      'telefono2'        => new sfValidatorPass(array('required' => false)),
      'telefono3'        => new sfValidatorPass(array('required' => false)),
      'numero_colegiado' => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'de_asindo'        => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'observaciones'    => new sfValidatorPass(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('pediatra_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Pediatra';
  }

  public function getFields()
  {
    return array(
      'id'               => 'Number',
      'nombre'           => 'Text',
      'apellido1'        => 'Text',
      'apellido2'        => 'Text',
      'fecha_alta'       => 'Date',
      'tipo_via'         => 'Text',
      'via'              => 'Text',
      'cp'               => 'Text',
      'numero'           => 'Number',
      'piso'             => 'Number',
      'letra'            => 'Text',
      'poblacion'        => 'Text',
      'provincia'        => 'Text',
      'email'            => 'Text',
      'telefono1'        => 'Text',
      'telefono2'        => 'Text',
      'telefono3'        => 'Text',
      'numero_colegiado' => 'Number',
      'de_asindo'        => 'Boolean',
      'observaciones'    => 'Text',
    );
  }
}
